/**  
 * All rights Reserved, Designed By www.xiaozhanjiaoyu.cn
 * @Title:  Entity.java   
 * @Package javaapplication.segmentation   
 * @Description:    TODO(用一句话描述该文件做什么)   
 * @author: knight.lu     
 * @date:   2018年11月22日 下午3:13:41   
 * @version V1.0 
 * @Copyright: 2018 www.xiaozhanjiaoyu.cn Inc. All rights reserved. 
 * 
 */
package com.ws.segmentation;

import java.util.ArrayList;
import java.util.List;

import com.alibaba.fastjson.JSONObject;

/**   
 * @ClassName:  Entity   
 * @Description: 请求体
 * @author: knight.lu 
 * @date:   2018年11月22日 下午3:13:41   
 *     
 */
public class Entity {
	
	private JSONObject req;
	
	public Entity(int dataType, Object dataValue) {
		Text text = new Text(dataType, dataValue);
		req = new JSONObject();
		List<JSONObject> list = new ArrayList<JSONObject>();
		JSONObject ce = new JSONObject();
		ce.put("text", text);
		list.add(ce);
		req.put("inputs", list);
	}
	
	public String parseJson() {
		return JSONObject.toJSONString(this.req);
	}
	static class Text{
		
		private int dataType;
		
		private Object dataValue;

		/**
		 * @param dataType
		 * @param dataValue
		 */
		public Text(int dataType, Object dataValue) {
			super();
			this.dataType = dataType;
			this.dataValue = dataValue;
		}

		public int getDataType() {
			return dataType;
		}

		public void setDataType(int dataType) {
			this.dataType = dataType;
		}

		public Object getDataValue() {
			return dataValue;
		}

		public void setDataValue(Object dataValue) {
			this.dataValue = dataValue;
		}
		
	}
}
